﻿/**
 *
 * 版权：C.c 版权所有
 *
 * 作者：C.c
 *
 * 版本：1.0
 *
 * 创建日期：2017/11/02
 *
 * 描述：全局变量
 *
 * 修订历史：
 *
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace XHFrame
{
    #region 全局枚举变量
    /// <summary>
    /// UI状态
    /// </summary>
    public enum EnumObjectState
    {
        /// <summary>
        /// 未知状态
        /// </summary>
        None,
        /// <summary>
        /// 初始化状态
        /// </summary>
        Initial,
        /// <summary>
        /// 过程状态(异步加载时)
        /// </summary>
        Loading,
        /// <summary>
        /// 已经打开
        /// </summary>
        Ready,
        /// <summary>
        /// 隐藏
        /// </summary>
        Disabled,
        /// <summary>
        /// 关闭
        /// </summary>
        Closing
    }
    /// <summary>
    /// UI类型
    /// </summary>
    public enum EnumUIType : int
    {
        /// <summary>
        /// 空
        /// </summary>
        None = -1,
        testOne = 0,
        testTwo = 1
    }

    public enum EnumTouchEventType
    {
        /// <summary>
        /// 点击事件
        /// </summary>
        OnClick,
        /// <summary>
        /// 两次点击
        /// </summary>
        OnDoubleClick,
        /// <summary>
        /// 按下
        /// </summary>
        OnDown,
        /// <summary>
        /// 抬起
        /// </summary>
        OnUp,
        /// <summary>
        /// 进入
        /// </summary>
        OnEnter,
        /// <summary>
        /// 退出
        /// </summary>
        OnExit,
        /// <summary>
        /// 选择
        /// </summary>
        OnSelect,
        /// <summary>
        /// 更新选定
        /// </summary>
        OnUpdateSelect,
        /// <summary>
        /// 取消选定
        /// </summary>
        OnDeSelect,
        /// <summary>
        /// 拖动事件
        /// </summary>
        OnDrag,
        /// <summary>
        /// 拖动事件
        /// </summary>
        OnDragEnd,
        /// <summary>
        /// 点
        /// </summary>
        OnDrop,
        /// <summary>
        /// 卷轴
        /// </summary>
        OnScroll,
        /// <summary>
        /// 移动 
        /// </summary>
        OnMove,

    }

    /// <summary>
    /// 角色类型
    /// </summary>
    public enum EnumActorType
    {
        /// <summary>
        /// 空的
        /// </summary>
        None = 0,
        /// <summary>
        /// 角色
        /// </summary>
        Role,
        /// <summary>
        /// 怪物
        /// </summary>
        Monster,
        /// <summary>
        /// NPC
        /// </summary>
        Npc,

    }

    public enum EnumPropertyType
    {
        /// <summary>
        /// 角色名
        /// </summary>
        RoleName = 1,
        /// <summary>
        /// 性别
        /// </summary>
        Sex,
        /// <summary>
        /// Role ID
        /// </summary>
        RoleID,
        /// <summary>
        /// 点券
        /// </summary>
        Gold,
        /// <summary>
        /// 金币
        /// </summary>
        Coin,
        /// <summary>
        /// 等级
        /// </summary>
        Level,
        /// <summary>
        /// 当前经验
        /// </summary>
        Exp,

        /// <summary>
        /// 共计速度
        /// </summary>
        AttackSpend,
        /// <summary>
        /// 当前HP
        /// </summary>
        HP,
        /// <summary>
        /// HP最大血量
        /// </summary>
        HPMax,
        /// <summary>
        /// 普通攻击
        /// </summary>
        Attack,
        /// <summary>
        /// 水属性攻击
        /// </summary>
        Water,
        /// <summary>
        /// 火属性攻击
        /// </summary>
        Fier,

    }

    public enum EnumSceneType
    {
        None = 0,
        StartGame,
        LoadingScene,
        LoginScene,
        MainScene,
        CopyScene,
        PVPScene,
        PVEscene
    }
    #endregion

    /// <summary>
    /// UI状态发生改变委托
    /// </summary>
    /// <param name="ui"> UI对象 </param>
    /// <param name="newState"> 新的UI状态 </param>
    /// <param name="oldState"> 改变前的状态 </param>
    public delegate void StateChangedEvent(object ui, EnumObjectState newState, EnumObjectState oldState);

    /// <summary>
    /// 消息事件委托
    /// </summary>
    /// <param name="message"></param>
    public delegate void MessageEvent(Message message);

    /// <summary>
    /// 属性改变传递
    /// </summary>
    /// <param name="actor">角色对象类</param>
    /// <param name="id">ID</param>
    /// <param name="oldValue">旧的值</param>
    /// <param name="newValue">新的值</param>
    public delegate void PropertyChangeHand(BaseActor actor, int id, object oldValue, object newValue);

    /// <summary>
    /// 消息事件管理
    /// </summary>
    /// <param name="_listener">事件触发的监听对象</param>
    /// <param name="_args"></param>
    /// <param name="_params"></param>
    public delegate void OnTouchEventHandle(GameObject _listener, object _args, params object[] _params);

    public class UIpathDefines
    {
        /// <summary>
        /// UI预设
        /// </summary>
        public const string UI_PREFAB = "Prefabs/";

        /// <summary>
        /// UI小控件预设
        /// </summary>
        public const string UI_CONTROLS_PREFAB = "UIPrefab/Control/";

        /// <summary>
        /// UI子页面预设
        /// </summary>
        public const string UI_SUBUI_PREFAB = "UIPrefab/SubUI/";

        /// <summary>
        /// Icon路径
        /// </summary>
        public const string UI_IOCN_PATH = "UI/Icon";

        /// <summary>
        /// 返回UI预设路径
        /// </summary>
        /// <param name="uIType"></param>
        /// <returns></returns>
        public static string GetUIPrefabsPathByType(EnumUIType uIType)
        {
            string _Path = string.Empty;
            switch (uIType)
            {
                case EnumUIType.None:
                    break;
                case EnumUIType.testOne:
                    _Path = UI_PREFAB + "OneTest";
                    break;
                case EnumUIType.testTwo:
                    _Path = UI_PREFAB + "TwoTest";
                    break;
                default:
                    Debug.Log("Not Find EnumUIType ! type :" + uIType.ToString());
                    // 插入日志系统
                    break;
            }
            return _Path;
        }

        /// <summary>
        /// 返回UI脚本类型
        /// </summary>
        /// <param name="_uiType"></param>
        /// <returns></returns>
        public static Type GetUIScriptByType(EnumUIType _uiType)
        {
            Type _scriptType = null;
            switch (_uiType)
            {
                case EnumUIType.None:
                    break;
                case EnumUIType.testOne:
                    _scriptType = typeof(OneTest);
                    break;
                case EnumUIType.testTwo:
                    _scriptType = typeof(TwoTest);
                    break;
                default:
                    break;
            }
            return _scriptType;
        }

    }

    /// <summary>
    /// 定义全局
    /// </summary>
    class Defines
    {
    }
}
